//
//  MKCDateFormatterEngine.m
//  ELearningClient
//
//  Created by Jim Fu on 2018/12/19.
//

#import "MKCDateFormatterEngine.h"

@implementation MKCDateFormatterEngine

+ (instancetype)sharedEngine {
    static MKCDateFormatterEngine *sharedInstance = nil;
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        sharedInstance = [[MKCDateFormatterEngine alloc] init];
    });
    return sharedInstance;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        self.yyyyDateFormatter = [[NSDateFormatter alloc] init];
        [self.yyyyDateFormatter setDateFormat:@"yyyy"];
        
        self.mmddDateFormatter = [[NSDateFormatter alloc] init];
        [self.mmddDateFormatter setDateFormat:@"MM-dd"];
        
        self.yyyymmddDateFormatter = [[NSDateFormatter alloc] init];
        [self.yyyymmddDateFormatter setDateFormat:@"yyyy-MM-dd"];
        
        self.yyyymmddDatePointFormatter = [[NSDateFormatter alloc] init];
        [self.yyyymmddDatePointFormatter setDateFormat:@"yyyy.MM.dd"];
        
        self.mmddhhmmDateFormatter = [[NSDateFormatter alloc] init];
        [self.mmddhhmmDateFormatter setDateFormat:@"MM-dd HH:mm"];
        
        self.yyyymmddhhmmDateFormatter = [[NSDateFormatter alloc] init];
        [self.yyyymmddhhmmDateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
        
        self.yyyymmdd_hhmmssDateFormatter = [[NSDateFormatter alloc] init];
        [self.yyyymmdd_hhmmssDateFormatter setDateFormat:@"yyyy-MM-dd-HH-mm-ss"];
        
        self.yyyymmddhhmmssDateFormatter = [[NSDateFormatter alloc] init];
        [self.yyyymmddhhmmssDateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
        
        self.yyyymmddChineseDateFormatter = [[NSDateFormatter alloc] init];
        [self.yyyymmddChineseDateFormatter setDateFormat:@"yyyy年MM月dd日"];
        
        self.yyyymmddhhmmssChineseDateFormatter = [[NSDateFormatter alloc] init];
        [self.yyyymmddhhmmssChineseDateFormatter setDateFormat:@"yyyy年MM月dd日 HH:mm:ss"];

        self.yyyymmddDateLineFormatter = [[NSDateFormatter alloc]init];
        [self.yyyymmddDateLineFormatter  setDateFormat:@"yyyy/MM/dd"];
    }
    return self;
}

@end
